#include <bits/stdc++.h>

using namespace std;
typedef long long ll;


void solve(){
    int n, m, t1, t2, k;
    cin >> n >> m >> t1 >> t2 >> k;
    vector<ll> a(n), b(m);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        a[i] += t1;
    }
    for(int i = 0; i < m; i++) cin >> b[i];
    int j = 0;
    ll ans = 0;
    if(k >= min(m, n)){
        cout << -1 << endl;
        return;
    }
    for(int i = 0; i <= k; i++){
        int x = a[i];
        while(j < m && b[j] < x){
            j++;
        }
        if(j + k - i >= m){
            cout << -1 << endl;
            return;
        }
        ans = max(ans, b[j + k - i] + t2);
    }
    cout << ans << endl;
}

int main(){
    solve();
    return 0;
}